﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace LFSRecord2.View.Converters
{
    public class LayerCollapseImageConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            BitmapImage collapseImage = new BitmapImage();

            collapseImage.BeginInit();
            if ((bool)value == true)
            {
                collapseImage.UriSource = new Uri("pack://application:,,,/data/bitmaps/icons/CollapseIconCollapsed.png");
            }
            else
            {
                collapseImage.UriSource = new Uri("pack://application:,,,/data/bitmaps/icons/CollapseIconExpanded.png");
            }
            collapseImage.EndInit();
            
            return collapseImage;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
